<!DOCTYPE html>
<html>
<head>
    <title>登录</title>
    <meta charset="UTF-8">
    <script type="text/javascript">
        function getCookie(name) {
            var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
            if (arr = document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return null;
        }

        window.onload = function () {
            var username = getCookie('username');
            var password = getCookie('password');
            document.getElementById("username").value = username;
            document.getElementById("password").value = password;
        }
    </script>
</head>
<body>
<form method="get" action="/Demo0311/login.do">
    用户名：<input id="username" type="text" name="username"/><br/>
    密 码：<input id="password" type="password" name="password"/><br/>
    <button type="submit">登录</button>
</form>
</body>
</html>